/**
 * 
 */
package com.wissen.giskard.server;

import org.hibernate.Query;
import org.hibernate.Session;

import com.wissen.giskard.server.domainobjects.User;

/**
 * @author Swapnil Sonawane
 *
 * @created date :09-Aug-2010
 */
public class UserValidation {

	public User validateUser(String userName,String password)
	{
		HibernateUtil hibernateUtil = new HibernateUtil();
		Session session = hibernateUtil.getSession();
		Query userValidateQuery=session.createQuery("from User user where user.name = :userName and user.password = :password ");
		userValidateQuery.setParameter("userName", userName);
		userValidateQuery.setParameter("password",password);
		User user=(User) userValidateQuery.uniqueResult();
		hibernateUtil.commit();
		return user;
		

	}
}
